home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Dev
/
misc
/
LOCCounter.lha
/
LOCCounter
/
src
/
FileCount.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2004-08-18
|
1KB
|
92 lines
/****************************************************************************
*
* $RCSfile: FileCount.cpp $
* $Revision: 2.6 $
* $Date: 2004/08/18 20:59:42 $
* $Author: ssolie $
*
*****************************************************************************
*
* Copyright (c) 2004 Steven Solie. All Rights Reserved.
*
*****************************************************************************
*
* FileCount component
*/
#include "FileCount.h"
#include <cstring>
FileCount::FileCount(const char* name, bool mode) :
m_loc(0),
m_loc_added(0),
m_loc_deleted(0),
m_diff_mode(mode)
{
std::strncpy(m_name, name, MAX_FILE_NAME_LEN);
m_name[MAX_FILE_NAME_LEN - 1] = '\0';
}
FileCount::~FileCount()
{
}
FileCount& FileCount::operator +=(uint32 loc)
{
if ( m_diff_mode ) {
m_loc_added += loc;
}
else {
m_loc += loc;
}
return *this;
}
FileCount& FileCount::operator -=(uint32 loc)
{
if ( m_diff_mode ) {
m_loc_deleted += loc;
}
else {
m_loc -= loc;
}
return *this;
}
const char* FileCount::getName() const
{
return m_name;
}
uint32 FileCount::getCount() const
{
return m_loc;
}
uint32 FileCount::getAddedCount() const
{
return m_loc_added;
}
uint32 FileCount::getDeletedCount() const
{
return m_loc_deleted;
}
bool FileCount::diffMode() const
{
return m_diff_mode;
}